<?php
	require_once("Basic.php");
	class Import {
		public static function css($css){
		    if(is_string($css)){
		    	$css=str_replace(".",DS,$css);
                Basic::eco("\r\n<link type='text/css' rel='stylesheet' href='".(Basic::fileExist("web".DS."css".DS.$css.".css")?CSS.$css.".css":"")."' />" );
            }else if(is_array($css)){
                foreach($css as $cs){
                	$cs=str_replace(".",DS,$cs);
                	Basic::eco("\r\n<link type='text/css' rel='stylesheet' href='".(Basic::fileExist("web".DS."css".DS.$cs.".css")?CSS.$cs.".css":"")."' />" );
				}
            }
		}
		public static function js($js){
		    if(is_string($js)){
		    	$js=str_replace(".",DS,$js);
		        Basic::eco("\r\n<script type='text/javascript' src='".(Basic::fileExist("web".DS."js".DS.$js.".js")?JS.$js.".js":"")."' ></script>" );
		    }else if(is_array($js)){
		        foreach($js as $j){
		        	$j=str_replace(".",DS,$j);
		        	Basic::eco("\r\n<script type='text/javascript' src='".(Basic::fileExist("web".DS."js".DS.$j.".js")?JS.$j.".js":"")."' ></script>" );
				}
		    }
		}
		public static function link($path=""){
			$extention = substr($path,strrpos($path,".",1)+1,(strlen($path)-strrpos($path,".",1)));
			$path = str_replace(".","/",substr($path,0,strrpos($path,".",1))).".".$extention;
			return Basic::fileExist("web".DS.$path)?WEB.$path:null;
		}
		public static function appLibs($file){
			if(is_string($file)){
				Basic::fileExist(APP_LIBS.$file.".php")?BASIC::need(APP_LIBS.$file.".php"):die("Error: Model with name '$file' does not exists.");
			}else if( is_array($file) ){
				foreach($file as $fil )Basic::fileExist(APP_LIBS.$fil.".php")?BASIC::need(APP_LIBS.$fil.".php"):die("Error: Model with name '$fil' does not exists.");
			}
		}
		public static function model($model){
			Basic::fileExist(APP_MODEL.$model.".php")?BASIC::need(APP_MODEL.$model.".php"):die("Error: Model with name '$model' does not exists.");
		}
		public static function controller($controller){
			Basic::fileExist(APP_CONTROLLER.$controller.".php")?BASIC::need(APP_CONTROLLER.$controller.".php"):null;
		}
		public static function config($file){
			Basic::fileExist(APP_CONFIG.$file.".php")?BASIC::need(APP_CONFIG.$file.".php"):null;
		}
		public static function core($file){
			Basic::fileExist(CORE.$file.".php")?Basic::need(CORE.$file.".php"):null;
		}
		public static function coreapp($file){
			Basic::fileExist(CORE_APP.$file.".php")?Basic::need(CORE_APP.$file.".php"):null;
		}
		public static function util($file){
			Basic::fileExist(CORE_UTIL.$file.".php")?Basic::need(CORE_UTIL.$file.".php"):null;
		}
		public static function perform($file){
			Basic::fileExist(CORE_PERFORM.$file.".php")?Basic::need(CORE_PERFORM.$file.".php"):null;
		}
		public static function html($file){
			Basic::fileExist(CORE_HTML.$file.".php")?Basic::need(CORE_HTML.$file.".php"):null;
		}
	}
